package entityMapping.demo1;

import javax.persistence.*;

@Entity
@Table(name = "COMPOSITE_KEY_ENTITY")
public class CompositeKeyEntity {

    @EmbeddedId
    private CompositeKey key;
    private String value;

    public CompositeKeyEntity() {
        this.key = new CompositeKey();
    }

    public String getKey1() {
        return key.getKey1();
    }

    public void setKey1(String key1) {
        key.setKey1(key1);
    }

    public String getKey2() {
        return key.getKey2();
    }

    public void setKey2(String key2) {
        key.setKey2(key2);
    }

    @Column(name = "VALUE")
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public CompositeKey getKey() {
        return key;
    }

    public void setKey(CompositeKey key) {
        this.key = key;
    }

    @Override
    public String toString() {
        return "CompositeKeyEntity{" +
                "key=" + key +
                ", value='" + value + '\'' +
                '}';
    }
}
